package com.example.gymmanagement.controller;

import com.example.gymmanagement.Utils.Result;
import com.example.gymmanagement.domain.User;
import com.example.gymmanagement.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;

@RestController
@RequestMapping("/register")
public class RegisterController {
    @Autowired
    private LoginService loginService;

    @PostMapping
    public Result register(@RequestBody User user){
        user.setUserCreatetime(LocalDateTime.now());
        return loginService.register(user);
    }
}
